#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QMenuBar* menubar = new QMenuBar();
    this->setMenuBar(menubar);
    //创建菜单
    QMenu* menu1 = new QMenu("文件(&F)");
    QMenu* menu2 = new QMenu("视图(&J)");

    menubar->addMenu(menu1);
    menubar->addMenu(menu2);
    //创建菜单项
    QAction* action1 = new QAction("菜单项1(&Q)");
    QAction* action2 = new QAction("菜单项2(&W)");
    QAction* action3 = new QAction("菜单项3(&R)");
    QAction* action4 = new QAction("菜单项4(&T)");
    menu1->addAction(action1);
    menu1->addAction(action2);
    menu2->addAction(action3);
    menu2->addAction(action4);

}

MainWindow::~MainWindow()
{
    delete ui;
}

